module.exports = () => {
    return async function (ctx, next) {
        if (ctx.path == "/login" || ctx.path == "/doLogin" || ctx.path == "/register" || ctx.path == "/doRegister") {
            await next();
        } else {
            if (ctx.cookies.get("login")) {
                await next();
            } else {
                await ctx.redirect("/login")
            }
        }
    }
}